<?php

/********************************/
class InvoiceAdministration {
/********************************/
    private static $wsdl = "https://test.e-szamla.hu/soap/AdministrationService.wsdl";
    private static $client = null;
    private static $sid = "";

    public static function setSID($sid) {
        self::$sid = $sid;
        self::$client = new SoapClient(self::$wsdl);
    }

    public static function registerCustomer(
        $name,
        $email,
        $taxnumber,
        $password       = LEAVE_DEFAULT,
        $locale         = LEAVE_DEFAULT,
        $notify         = LEAVE_DEFAULT,
        $mailTemplate   = LEAVE_DEFAULT
    ) {
        $request = array(
            sessionid => self::$sid,
            name      => $name,
            email     => $email,
        );
        if ($password     != LEAVE_DEFAULT) { $request['password'] = $password; }
        if ($notify       == LEAVE_DEFAULT) { $notify = 1; }
        if ($mailTemplate != LEAVE_DEFAULT) { $request['mailTemplate'] = $mailTemplate; }
        $request['notify'] = $notify;
        $result = self::$client->registerCustomer($request);
        return array(
            $result->username,
            $result->oassword,
        );
    }
}

?>
